<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
  <meta name="description" content="">
  <meta name="author" content="ThemeBucket">
  <link rel="shortcut icon" href="#" type="../image/png">
  <title>Demo</title>
  <!--data table-->
  <link rel="stylesheet" href="../js/data-tables/DT_bootstrap.css" />

</head>
<body class="sticky-header" onload="indexmenu('${oneMenu}','${twoMenu}');">
<%@ include file="../index/index.jsp" %>
<section>
	<div class="main-content">
		<!-- 外面是最外层包裹 -->
        <!-- 地址栏-->
		<div class="page-heading">
            <h3>
                	后台管理系统
            </h3>
            <ul class="breadcrumb">
                <li>
                    <a href="#">商城管理</a>
                </li>
                <li class="active">商品管理</li>
            </ul>
        </div>   
		<!--这里是写一些内容的  -->
		<div class="row">
	        <div class="col-sm-12">
	        	<section class="panel">
		        	<div class="panel-body">
		        		<div class="adv-table">
		      				<div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline" role="grid">
		        				<button class="btn btn-success" type="button" onclick="addGoods()">上架商品</button>
		        				<div class="span6">
		        					<h4>商品列表:</h4>
		        					<div class="dataTables_filter" id="dynamic-table_filter">
							        	<input type="text" class="form-control" placeholder="搜索商品" aria-controls="dynamic-table">
							        	<button  class="btn btn-default" type="button" id="search">搜索</button>			        							
		  							</div>
		       		 			</div>
		       				</div>
		       				<!--表格开始  -->
			       			<table class="display table table-bordered table-striped dataTable table-hover" id="dynamic-table" aria-describedby="dynamic-table_info">
			        			<thead>
						        	<tr role="row">
						        		<th class="sorting" role="columnheader" tabindex="0" aria-controls="dynamic-table" rowspan="1" colspan="1" style="width: 50px;" aria-label="Rendering engine: activate to sort column ascending">商品id</th>						        	
						        		<th class="sorting" role="columnheader" tabindex="0" aria-controls="dynamic-table" rowspan="1" colspan="1" style="width: 100px;" aria-label="Rendering engine: activate to sort column ascending">商品图片</th>						        		
						        		<th class="sorting" role="columnheader" tabindex="0" aria-controls="dynamic-table" rowspan="1" colspan="1" style="width: 183px;" aria-label="Rendering engine: activate to sort column ascending">商品描述</th>
						        		<th class="" role="columnheader" tabindex="0" aria-controls="dynamic-table" rowspan="1" colspan="1" style="width: 100px;" aria-label="Platform(s): activate to sort column ascending">
						        			
						        			
						        			
						        			
						        			
						        			
						        			<select id="goodsTypeSelect">
						        				<c:if test="${type==9}">
								        			<option value="9" selected="selected">商品类别</option>
							        				<option value="0">布艺帘</option>
							        				<option value="1">成品帘</option>
							        				<option value="2">配件</option>					        				
						        				</c:if>
						        				<c:if test="${type==0}">
								        			<option value="9">商品类别</option>
							        				<option value="0" selected="selected">布艺帘</option>
							        				<option value="1">成品帘</option>
							        				<option value="2">配件</option>							        				
						        				</c:if>
						        				<c:if test="${type==1}">
								        			<option value="9">商品类别</option>
							        				<option value="0">布艺帘</option>
							        				<option value="1" selected="selected">成品帘</option>
							        				<option value="2">配件</option>							        				
						        				</c:if>						        			
						        				<c:if test="${type==2}">
								        			<option value="9">商品类别</option>
							        				<option value="0">布艺帘</option>
							        				<option value="1">成品帘</option>
							        				<option value="2" selected="selected">配件</option>							        				
						        				</c:if>
						        			</select>
						        		</th>
										<th class="sorting_desc" role="columnheader" tabindex="0" aria-controls="dynamic-table" rowspan="1" colspan="1" style="width: 100px;" aria-sort="descending" aria-label="Browser: activate to sort column ascending">商品价格</th>   
						        		<th class="sorting" role="columnheader" tabindex="0" aria-controls="dynamic-table" rowspan="1" colspan="1" style="width: 50px;" aria-label="Rendering engine: activate to sort column ascending">计价单位</th>							        		
						        		<th class="hidden-phone sorting" role="columnheader" tabindex="0" aria-controls="dynamic-table" rowspan="1" colspan="1" style="width: 100px;" aria-label="Engine version: activate to sort column ascending">销量(单)</th>
						        		<th class="sorting_asc" role="columnheader" tabindex="0" aria-controls="dynamic-table" rowspan="1" colspan="1" style="width: 145px;" aria-label="Platform(s): activate to sort column ascending">一级经销商利润</th>
						        		<th class="sorting_asc" role="columnheader" tabindex="0" aria-controls="dynamic-table" rowspan="1" colspan="1" style="width: 145px;" aria-label="Platform(s): activate to sort column ascending">一级抽取二级利润</th>
						        		<th class="sorting_asc" role="columnheader" tabindex="0" aria-controls="dynamic-table" rowspan="1" colspan="1" style="width: 145px;" aria-label="Platform(s): activate to sort column ascending">二级经销商利润</th>						        								        								        		
						        		<th class="sorting_asc" role="columnheader" tabindex="0" aria-controls="dynamic-table" rowspan="1" colspan="1" style="width: 60px;" aria-label="Platform(s): activate to sort column ascending">特卖</th>
						        		<th  tabindex="0"  rowspan="1" colspan="1" style="width: 60px;" >系列号</th>
						        		<th  style="width: 106px;">编辑</th>
						        	</tr>
						        </thead>
							    <tbody role="alert" aria-live="polite" aria-relevant="all">
							    	<c:forEach var="page" items="${SampleList}">
							        	<tr class="gradeA even" >
								            <td class="" data-toggle="modal" data-target="#myModal" onclick="clickGoods(${page.sampleId})">${page.sampleId}</td>
								          	<td class="" ><img src="http://okwc9gyzs.bkt.clouddn.com/${page.sampleImg}" style="width:200px"></td>				           				
								            <td class="">${page.sampleDescribe}</td>
								            
								            <c:if test="${page.type==0}">
						            			<td class="">布艺帘</td> 
						            			<td class="">${page.holePrice}(打孔)<br>
						            						${page.zhePrice}(韩褶)<br>
						            						${page.ssPrice}(纱韩褶价格)
						            			</td>  
								            </c:if>							
								           	<c:if test="${page.type==1}" >
								            	<c:forEach var="finType" items="${finType}">
								            		<c:if test="${finType.fptId==page.fptId}">
								            			<td class="">${finType.fptBody}</td>
								          				<td class="">${page.price}</td>	
								            		</c:if>
								            	</c:forEach>
								            </c:if>
 								           	<c:if test="${page.type==2}" >
								            	<c:forEach var="accType" items="${acc}">
								            		<c:if test="${accType.accessoriesTypeId==page.accessoriesTypeId}">
								            			<!--类型--><td class="">${accType.accessoriesTypeContent}</td>
								          				<!-- 价格 --><td class="">${page.price}</td>	
								            		</c:if>
								            	</c:forEach>
								            </c:if>
								            <!-- 计价单位 --><td class="">${page.chargeUnit}</td>		
								            <!-- 销量 --><td class="">${page.sale}</td>
								            <!--一级  --><td class="">${page.firstProfit}</td>
								            <!--一级提二级  --><td class="">${page.ssProfit}</td>
								            <!--二级 --><td class="">${page.secondProfit}</td>	
								            <td class="">
								            	<c:if test="${page.special==0}">
								            		不是
								            	</c:if>
								            	<c:if test="${page.special==1}">
								            		是
								            	</c:if>													            	
								            </td>
								            <td class="">${page.series}</td>	
								          	<td class="">
								          		<button class="btn btn-info" type="button" onclick="toUpdateGoods(${page.sampleId})">修改</button>
								          		<button class="btn btn-danger" type="button" onclick="downGoods(${page.sampleId},0)" >下架</button><br>
								          		<button class="btn btn-danger" type="button" onclick="deleteGoods(${page.sampleId})" >删除</button><br>								      
								          	</td>						            
								        </tr>							    		
    	
							    	</c:forEach>
							    
							    
		        
							  	</tbody>
							</table>
							<!-- 表格结束 -->
							<!-- 分页开始 -->
						  	<div class="row-fluid">
							  	<div class="span6">
								  	<div class="dataTables_paginate paging_bootstrap pagination">
									  	<ul>
									  		<li class="page-item">
									  			<c:if test="${type==9}">
									  				<a class="page-link" href="../shoppingmall/goods.do?currentPage=1&state=1">首页</a>
									  			</c:if>
									  			<c:if test="${type!=9}">
									  				<a class="page-link" href="../shoppingmall/goodsByType.do?currentPage=1&type=${type}&state=1">首页</a>
									  			</c:if>
									  		</li>									  		
								  			<c:choose>
									  			<c:when test="${page.currentPage==1}">
									  				<li class="prev">
									  					<a class="page-link">← 上一页</a>
									  				</li>
									  			</c:when>
									  			<c:otherwise>
									  				<li class="prev">
											  			<c:if test="${type==9}">
											  				<a class="page-link" href="../shoppingmall/goods.do?currentPage=${page.currentPage-1}&state=1">← 上一页</a>
											  			</c:if>
											  			<c:if test="${type!=9}">
											  				<a class="page-link" href="../shoppingmall/goodsByType.do?currentPage=${page.currentPage-1}&type=${type}&state=1">← 上一页</a>
											  			</c:if>
									  					
									  				</li>
									  			</c:otherwise>						  			
								  			</c:choose>
						                  <c:forEach begin="1" end="${page.totalPage}" var="p">
						                    	<c:choose>
						                    		<c:when test="${page.currentPage==p}">
						                    			<c:if test="${p==1}">
						                    				<li  class="active page-item">
						                    				<c:if test="${type==9}">
						                    					<a class="page-link" href="../shoppingmall/goods.do?currentPage=${p}&state=1" class="page-link">${p}</a>
						                    				</c:if>
						                    				<c:if test="${type!=9}">
						                    					<a class="page-link" href="../shoppingmall/goodsByType.do?currentPage=${p}&type=${type}&state=1" class="page-link">${p}</a>
						                    				</c:if>
				
						                    				</li> 
						                    				<c:if test="${page.totalPage>1}">
						                    					<li  class="page-item">
								                    				<c:if test="${type==9}">
								                    					<a class="page-link" href="../shoppingmall/goods.do?currentPage=${p+1}&state=1">${p+1}</a>
								                    				</c:if>
								                    				<c:if test="${type!=9}">
								                    					<a class="page-link" href="../shoppingmall/goodsByType.do?currentPage=${p+1}&type=${type}&state=1" class="page-link">${p+1}</a>
								                    				</c:if>	
						                    						
						                    					</li>
						                    				</c:if>
						                    				<c:if test="${page.totalPage>2}">
						                    					<li  class="page-item">
						                    						<c:if test="${type==9}">
								                    					<a class="page-link" href="../shoppingmall/goods.do?currentPage=${p+2}&state=1">${p+2}</a>
								                    				</c:if>
								                    				<c:if test="${type!=9}">
								                    					<a class="page-link" href="../shoppingmall/goodsByType.do?currentPage=${p+2}&type=${type}&state=1" class="page-link">${p+2}</a>
								                    				</c:if>
						                    						
						                    					</li>
						                    				</c:if>
						                    				<c:if test="${page.totalPage>3}">
							                    				<li class="page-item"><a class="page-link" href="#">...</a></li>
							                    			</c:if>
						                    			</c:if>
						                    			<c:if test="${p>1}">                   			                   			
							                    			<c:if test="${p<page.totalPage}">
							                    				<c:if test="${p>2}">
							                    					<li class="page-item"><a class="page-link" href="#">...</a></li>
							                    				</c:if>
							                    				<li class="page-item">
							                    					<c:if test="${type==9}">
								                    					<a class="page-link" href="../shoppingmall/goods.do?currentPage=${p-1}&state=1">${p-1}</a>
								                    				</c:if>
								                    				<c:if test="${type!=9}">
								                    					<a class="page-link" href="../shoppingmall/goodsByType.do?currentPage=${p-1}&type=${type}&state=1" class="page-link">${p-1}</a>
								                    				</c:if>
							                    				</li>
							                    				<li class="active page-item">
							                    					<c:if test="${type==9}">
							                    						<a class="page-link" href="../shoppingmall/goods.do?currentPage=${p}&state=1" class="current_page">${p}</a>
								                    				</c:if>
								                    				<c:if test="${type!=9}">
								                    					<a class="page-link" href="../shoppingmall/goodsByType.do?currentPage=${p}&type=${type}&state=1" class="page-link">${p}</a>
								                    				</c:if>
							                    				</li>
							                    				<c:if test="${page.totalPage>2}">
							                    					<li class="page-item">
								                    					<c:if test="${type==9}">
							                    							<a class="page-link" href="../shoppingmall/goods.do?currentPage=${p+1}&state=1">${p+1}</a>
									                    				</c:if>
									                    				<c:if test="${type!=9}">
									                    					<a class="page-link" href="../shoppingmall/goodsByType.do?currentPage=${p+1}&type=${type}&state=1" class="page-link">${p+1}</a>
									                    				</c:if>
							                    					</li>
							                    				</c:if>
							                    				<c:if test="${page.totalPage-p>1}">
							                    					<li class="page-item"><a class="page-link" href="#">...</a></li>
							                    				</c:if>
							                    			</c:if>
							                    			<c:if test="${p==page.totalPage}">
							                    				<c:if test="${p>3}">
							                    					<li class="page-item"><a class="page-link" href="#">...</a></li>
							                    				</c:if>
							                    				<c:if test="${p>2}">
							                    					<li class="page-item">
							                    						<c:if test="${type==9}">
							                    							<a class="page-link" href="../shoppingmall/goods.do?currentPage=${p-2}&state=1">${p-2}</a>
									                    				</c:if>
									                    				<c:if test="${type!=9}">
									                    					<a class="page-link" href="../shoppingmall/goodsByType.do?currentPage=${p-2}&type=${type}&state=1" class="page-link">${p-2}</a>
									                    				</c:if>
							                    					</li>
							                    				</c:if>
							                    				<li class="page-item">
							                    						<c:if test="${type==9}">
							                    							<a class="page-link" href="../shoppingmall/goods.do?currentPage=${p-1}&state=1">${p-1}</a>
									                    				</c:if>
									                    				<c:if test="${type!=9}">
									                    					<a class="page-link" href="../shoppingmall/goodsByType.do?currentPage=${p-1}&type=${type}&state=1" class="page-link">${p-1}</a>
									                    				</c:if>
							                    				</li>
							                    				<li class="active page-item">
							                    						<c:if test="${type==9}">
							                    							<a class="page-link" href="../shoppingmall/goods.do?currentPage=${p}&state=1" class="current_page">${p}</a>
									                    				</c:if>
									                    				<c:if test="${type!=9}">
									                    					<a class="page-link" href="../shoppingmall/goodsByType.do?currentPage=${p}&type=${type}&state=1" class="page-link">${p}</a>
									                    				</c:if>
							                    				</li>
							                    			</c:if>
						                    			</c:if>
						                    		</c:when>
						                    	</c:choose>
						                    </c:forEach>					

								  			<c:choose>
									  			<c:when test="${page.currentPage==page.totalPage}">
									  					<li class="pre"><a class="page-link">下一页 → </a></li>
									  			</c:when>
									  			<c:otherwise>
									  					<li class="pre">
									  						<c:if test="${type==9}">
											  					<a class="page-link" href="../shoppingmall/goods.do?currentPage=${page.currentPage+1}&state=1">← 下一页</a>
											  				</c:if>
											  				<c:if test="${type!=9}">
											  					<a class="page-link" href="../shoppingmall/goodsByType.do?currentPage=${page.currentPage+1}&type=${type}&state=1">← 下一页</a>
											  				</c:if>
									  						
									  					</li>
									  			</c:otherwise>	 							  			
								  			</c:choose>

								  			<li class="page-item">
								  				<c:if test="${type==9}">
											  			<a class="page-link" href="../shoppingmall/goods.do?currentPage=${page.totalPage}&state=1">尾页</a>
											  	</c:if>
											  	<c:if test="${type!=9}">
											  			<a class="page-link" href="../shoppingmall/goodsByType.do?currentPage=${page.totalPage}&type=${type}&state=1">尾页</a>
											  	</c:if>
								  			
								  			</li>

											<li class="page-item">
											 	<a class="page-link">总共${page.totalPage}页</a>
											 </li>
									  	</ul>
								  	</div>
								</div>
							</div>
							<!-- 分页结束 -->
							
						
						</div>
					</div>
        		</section>
        	</div>
       </div>
       <!-- 查看详情的模态框 -->
		<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		  <div class="modal-dialog">
		    <div class="modal-content">
		      <div class="modal-header">
		        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
		        <h4 class="modal-title" id="myModalLabel">商品详情</h4>
		      </div>
		      <div class="modal-body">
		       <!--这是模态框内容  -->
	       
		       <!-- 这是模态框内容结束 -->
		      </div>
		      <div class="modal-footer">
		        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
		        <button type="button" class="btn btn-primary">保存</button>
		      </div>
		    </div>
		  </div>
		</div>       
       
		<!-- 模态框结束 -->
	<!-- 内容结束 -->
	</div>
</section>


</body>
  <script src="../js/shoppingmall/goods.js"></script>
</html>
